﻿
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace Conquest
{
    /// <summary>
    /// Description of PlayerPad.
    /// </summary>
    public partial class PlayerPad : UserControl
    {
        public event Homeland.HomelandHandler StateChanged;
        
        private int _Score;
        
        public PlayerPad()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            
            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            this.EnabledChanged += delegate(object sender, EventArgs e) 
            {
                PlayerPad pad = (PlayerPad) this;
                if (pad.Enabled)
                {
                    pad.groupBox1.ForeColor = Color.Blue;
                }
                else
                {
                    pad.groupBox1.ForeColor = Color.Black;
                }
            };
            
            this.homeland1.StateChanged += delegate(Homeland homland) 
            {
                if (StateChanged != null)
                {
                    StateChanged(homeland1);
                }
            };
        }
        
        public string PlayerName
        {
            get { return homeland1.PlayerName; }
            set 
            { 
                homeland1.PlayerName = value; 
                this.groupBox1.Text = value;
            }
        }
        
        public int Score
        {
            get { return _Score; }
            set 
            { 
                _Score = value; 
                scoreLabel.Text = "" + _Score;
            }
        }
        
        public Conquest.Homeland Homeland
        {
            get { return this.homeland1; }
        }
        
    }
}
